interface Action {
    public String[] test(String str);
}

class Test {
    public static void main(String[] args) {
        Action action1 = new Action() {
            @Override
            public String[] test(String str) {
                return str.split("|");
            }
        };
        Action action2 = new Action() {
            @Override
            public String[] test(String str) {
                return str.split("-");
            }
        };
        String str1 = "a|b|c";
        String str2 = "a-b-c";
        String[] result1 = action1.test(str1);
        String[] result2 = action2.test(str2);
        for (String s : result1) {
            System.out.print(s + " ");
        }
        System.out.println();
        for (String s : result2) {
            System.out.print(s + " ");
        }
    }
}